<template>
  <el-row type="flex" justify="space-between">
    <el-button type="primary" @click="addFn">{{ category===1?'添加分类':'添加经纪' }}</el-button>
    <el-input v-model="input" placeholder="请输入内容" class="input-with-select">
      <el-button slot="append" icon="el-icon-search" @click="search(true)" />
    </el-input>
  </el-row>
</template>

<script>
// import { getCategory } from '@/api/category'

export default {
  props: {
    category: {
      type: [Number, String],
      required: true
    }
  },
  data() {
    return {
      input: '',
      xinshuju: []

    }
  },
  watch: {
    input(val) {
      if (val) {
        this.search(true)
      } else {
        this.search(false)
      }
    }
  },
  methods: {
    addFn() {
      this.$emit('addEvent')
    },
    search(bool) {
      // console.log(1)
      if (bool) {
        this.$emit('Asearch', this.input)
      }
    }

  }

}
</script>

<style lang='scss' scoped>
.el-input{
  width: 600px;
  .el-input__inner{
  width: 100%;
  height: 40px;
}
}
.el-row{
  margin-bottom: 20px;
}

</style>
